home *** CD-ROM | disk | FTP | other *** search
/ 3D Games - Real-time Rend…ng & Software Technology / 3D Games - Real-time Rendering & Software Technology.iso / flysdk / frontend / flyEditor / DlgEditList.cpp next >
Encoding:
C/C++ Source or Header  |  2001-01-07  |  2.2 KB  |  107 lines

  1. // DlgEditList.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "flyeditor.h"
  6. #include "DlgEditList.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CDlgEditList dialog
  16.  
  17.  
  18. CDlgEditList::CDlgEditList(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CDlgEditList::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CDlgEditList)
  22.         // NOTE: the ClassWizard will add member initialization here
  23.     //}}AFX_DATA_INIT
  24. }
  25.  
  26.  
  27. void CDlgEditList::DoDataExchange(CDataExchange* pDX)
  28. {
  29.     CDialog::DoDataExchange(pDX);
  30.     //{{AFX_DATA_MAP(CDlgEditList)
  31.     DDX_Control(pDX, IDC_LIST1, m_list);
  32.     //}}AFX_DATA_MAP
  33. }
  34.  
  35.  
  36. BEGIN_MESSAGE_MAP(CDlgEditList, CDialog)
  37.     //{{AFX_MSG_MAP(CDlgEditList)
  38.     ON_LBN_DBLCLK(IDC_LIST1, OnDblclkList1)
  39.     //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CDlgEditList message handlers
  44.  
  45. BOOL CDlgEditList::OnInitDialog() 
  46. {
  47.     CDialog::OnInitDialog();
  48.     
  49.     int i=m_list.AddString("<None>");
  50.     m_list.SetItemData(i,0);
  51.     m_list.SetCurSel(i);
  52.  
  53.     short int i1,i2;
  54.     i1=pd->type&0xffff;
  55.     i2=pd->type>>16;
  56.  
  57.     if (pd->type=='d' || i1<-255)
  58.     {
  59.         bsp_object *o=flyengine->active_obj0;
  60.         while(o)
  61.         {
  62.             if ((i2 && o->type>=-i1 && o->type<=-i2) ||
  63.                 pd->type=='d' || pd->type==-o->type)
  64.             {
  65.                 i=m_list.AddString(o->long_name);
  66.                 m_list.SetItemData(i,(DWORD)o);
  67.             }
  68.             o=(bsp_object *)o->next_obj;
  69.         }
  70.     }
  71.     else
  72.     if (pd->type=='o' || i1>255)
  73.     {
  74.         bsp_object *o=flyengine->stock_obj0;
  75.         while(o)
  76.         {
  77.             if ((i2 && o->type>=i1 && o->type<=i2) ||
  78.                 pd->type=='o' || pd->type==o->type)
  79.             {
  80.                 i=m_list.AddString(o->long_name);
  81.                 m_list.SetItemData(i,(DWORD)o);
  82.             }
  83.             o=(bsp_object *)o->next_obj;
  84.         }
  85.     }
  86.     SetFocus();
  87.     
  88.     return TRUE;  // return TRUE unless you set the focus to a control
  89.                   // EXCEPTION: OCX Property Pages should return FALSE
  90. }
  91.  
  92. void CDlgEditList::OnOK() 
  93. {
  94.     int sel=m_list.GetCurSel();
  95.     
  96.     bsp_object *obj=(bsp_object *)m_list.GetItemData(sel);
  97.  
  98.     *((bsp_object **)pd->data)=obj;
  99.     
  100.     CDialog::OnOK();
  101. }
  102.  
  103. void CDlgEditList::OnDblclkList1() 
  104. {
  105.     OnOK();
  106. }
  107.